<?PHP

	class tpl_managebans {
		
		public static function managebans(){
		
			if(empty($GLOBALS['OUTPUT']->bans)){
				$ban_html = <<<EOV
<tr>
	<td class='td2' colspan='3' style='text-align: center; font-style: italic'>{$GLOBALS['LANG']->lang_admin->no_bans_found}</td>
</tr>
EOV;
			}else{
				$class = 'td1';
				
				$ban_html = '';
				foreach($GLOBALS['OUTPUT']->bans as $bid=>$bdata){
					$class = ($class == 'td1' ? 'td2' : 'td1');
					
					$ban_id = (isset($bdata['name']) ? $bdata['name'] : $bdata['ip']);
					$ban_end = ($bdata['end'] == '0' ? $GLOBALS['LANG']->lang_admin->never : date($GLOBALS['OUTPUT']->settings['long_date_format'],$bdata['end']));
					
					$ban_html .= <<<EOV
<tr>
	<td class='{$class}' width='40%'>{$ban_id}</td>
	<td class='{$class}' width='40%'>{$ban_end}</td>
	<td class='{$class}' width='20%'><a href='./index.php?act=admin&page=managebans{$GLOBALS['OUTPUT']->ses}&delete={$bid}'>[{$GLOBALS['LANG']->lang_admin->delete}]</a></td>
</tr>
EOV;
				}
			}
			
			$pages_html = '';
			
			for($curpage = 1; $curpage <= $GLOBALS['OUTPUT']->pages; $curpage++){
				
				$selected = ($curpage == $GLOBALS['OUTPUT']->page ? " selected='true'" : '');
				
				$pages_html .= <<<EOV
	<option {$selected} onclick="document.location='./index.php?act=admin&&page=managebans{$GLOBALS['OUTPUT']->ses}&pager={$curpage}'">{$curpage}</option>
EOV;
			}
			
			return	tpl_globals::header() .
				<<<EOV
	<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->managebans}</div>
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		<tr>
			<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->banvalue}</td>
			<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->remaining}</td>
			<td class='table_header_row' width='20%'>{$GLOBALS['LANG']->lang_admin->action}</td>
		</tr>
		{$ban_html}
		<tr>
			<td class='table_header_row' width='100%' colspan='3'>{$GLOBALS['LANG']->lang_admin->page}: &nbsp;
				<select style='width: 60px;'>
					{$pages_html}
				</select>
			</td>
		</tr>
	</table>
		
	<br />
		
	<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=managebans' method='post'>
	
		<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->addban}</div>
		<table style='width: 100%;' cellspacing='1' cellpadding='5'>
			{$GLOBALS['OUTPUT']->form}
			<tr>
				<td class='table_header_row' colspan='2' style='text-align: center'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
			</tr>
		</table>
	</form>
EOV
.
			tpl_globals::footer();
				
		}
		
	}

?>